/*!
	* @Title: 产品管理
	* @author 		naluv125@hotmail.com
	* @date 			2013-7-29 下午12:59:34   
	* @version    	V1.0
 */

Ext.define('MyDesktop.Tprod', {
    extend: 'Ext.ux.desktop.Module',

    requires: [
        'Bleext.abstract.GridForm'
    ],

    id:'tprod-win',

    init : function(){
        this.launcher = {
            text: '产品管理',
            iconCls:'img_prod'
        };
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('tprod-win');
        if(!win){
        	var prod = this.buildDistModule();
            win = desktop.createWindow({
                id: 'tprod-win',
                title:'产品管理',
                width:990,
                height:610,
                iconCls: 'img_prod',
                animCollapse:false,
                border:false,
                constrainHeader:true, //窗口顶部不能超过浏览器外界
                layout: 'fit',
                items: [prod]
            });
        }
        return win;
    },
    
    buildDistModule:function(){
    		var prodInst = Ext.create('Bleext.abstract.GridForm',{
    			pageLoad:true,
    			formColumnCount:2,
    			gridColumnCount:6,
    			gridTitle : '查询结果',
    			formTitle: '产品查询',
    		    loadGridUrl:BP+'prod/pageQueryTprod',
    		    addUrl:BP+'prod/insertTprod',
    			updateUrl:BP+ 'prod/updateTprod',
    			removeUrl:BP+'prod/removeTprod',
    		    
    			columnConfig: [ {header: 'ID', dataIndex: 'id', hideGrid: true, hideForm: 'add', hidden:true ,readOnly: true},
    				            			{header: '产品编号', dataIndex: 'productCode', allowBlank:false,remoteSort:true,sortable:true,uneditable:true,width:150},
			    				            {header: '产品名称', dataIndex: 'productName', allowBlank:false,width:150},
			    				            {header: '产品价格', dataIndex: 'productPrice',allowBlank:false,vtype:'price',type : 'double',width:150},
			    				            {header: 'PV', dataIndex: 'productPv',allowBlank:false,vtype:'price',type : 'double',width:150},
			    				            {header: 'BV', dataIndex: 'productBv',allowBlank:false,vtype:'price',type : 'double',width:150}, 
			    				            {header: '产品状态', dataIndex: 'status',allowBlank:false , fieldtype:'validCombo',hiddenName:'status',hideGrid:true,width:150},
			    				            {header: '产品状态_hideform', dataIndex: 'status_name',hideForm:'all',width:150},
			    				            {header: '备注', dataIndex: 'remark',width:600,colspan:6}],
    			                 			 
    			formConfig:[{xtype:'textfield', fieldLabel: '产品编号', name: 'productCode', anchor:'100%'},
    			               		  {xtype:'textfield', fieldLabel: '产品名称', name: 'productName', anchor:'100%'}]
    		});
    		return prodInst;
    }
});
